import os
import yaml

# Project Folder
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

# Load yaml configuration
env = os.getenv('FLASK_ENV')
if env == 'DEV':
    config_file = os.path.join(BASE_DIR, 'config', 'dev_config.yaml')
elif env == 'QA':
    config_file = os.path.join(BASE_DIR, 'config', 'home_qa_config.yaml')
elif env == 'PROD':
    config_file = os.path.join(BASE_DIR, 'config', 'prod_config.yaml')
else:
    config_file = os.path.join(BASE_DIR, 'config', 'home_qa_config.yaml')
with open(config_file, 'r') as file:
    config = yaml.safe_load(file)

# DB info
server = config['database']['server']
database = config['database']['database']
username = config['database']['username']
password = config['database']['password']
driver = config['database']['driver']

# Remote info
remote_server = config['remote-info']['server']
remote_port = config['remote-info']['port']
remote_username = config['remote-info']['username']
remote_password = config['remote-info']['password']

# Compass workflow web
wf_web_server = config['compass-workflow-web']['server']
wf_web_port = config['compass-workflow-web']['port']
organization_id = config['compass-workflow-web']['organization_id']
CDIA_folder_path = config['compass-workflow-web']['CDIA_folder_path']
CDIA_deploy_folder_path = config['compass-workflow-web']['CDIA_Deployment_folder_path']

# Compass workflow api
wf_api_server = config['compass-workflow-api']['server']
wf_api_port = config['compass-workflow-api']['port']
x_api_key = config['compass-workflow-api']['x-api-key']

# compass web
ui_server = config['compass-web']['server']
ui_port = config['compass-web']['port']

# PPA
ppa_agent_folder_path = config['ppa']['agent_folder_path']
ppa_shared_folder_path = config['ppa']['shared_folder_path']
ppa_prefix_to_api = config['ppa']['prefix_to_api']
ppa_prefix_to_folder = config['ppa']['prefix_to_folder']
queue_name_historical_pl = config['ppa']['prefix_to_api']['historical_pl_']
queue_name_historical_pl_attribution = config['ppa']['prefix_to_api']['historical_pl_attribution_']
queue_name_historical_returns = config['ppa']['prefix_to_api']['historical_returns_']
queue_name_portfolio_management = config['ppa']['prefix_to_api']['portfolio_management_']
queue_name_external_cash_flow = config['ppa']['prefix_to_api']['external_cash_flow_']
queue_name_benchmark_performance = config['ppa']['prefix_to_api']['benchmark_performance_']
queue_name_portfolio_data = config['ppa']['prefix_to_api']['portfolio_data_']
queue_name_portfolio_grouping = config['ppa']['prefix_to_api']['portfolio_grouping_']
queue_name_position = config['ppa']['prefix_to_api']['position_']
queue_name_transaction = config['ppa']['prefix_to_api']['transaction_']
queue_name_aggregate = config['ppa']['prefix_to_api']['aggregate_']
queue_name_exchange_rate = config['ppa']['prefix_to_api']['exchange_rate_']

# chrome
chrome_path = config['chrome']['chrome-path']
chrome_driver_path = config['chrome']['chrome-driver-path']


if __name__ == '__main__':
    print(ppa_agent_folder_path)
